package com.example.demo.mapper.sysconfig;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo.bean.PageRes;
import com.example.demo.bean.sysconfig.SysConfigDO;
import com.example.demo.dto.sysconfig.SysConfigPageReqVO;
import com.example.demo.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface SysConfigMapper extends BaseMapperX<SysConfigDO> {

    default PageRes<SysConfigDO> selectPage(SysConfigPageReqVO reqVO){
        Page<SysConfigDO> page = new Page<>(reqVO.getPageNo(), reqVO.getPageSize());
        return selectPageCommon(page,new QueryWrapper<SysConfigDO>()
                .like(ObjectUtil.isNotNull(reqVO.getConfigName()),"config_name",reqVO.getConfigName())
                .like(ObjectUtil.isNotNull(reqVO.getConfigKey()),"config_key",reqVO.getConfigKey()));
    }
}
